package dao

import (
	"context"
	"sale-admin/internal/dal"
	"sale-admin/internal/models"
)

type Activity struct{}

// Exists 判断留资活动是否存在
func (Activity) Exists(ctx context.Context, ID string) bool {
	a := dal.MaActivity
	count, _ := a.WithContext(ctx).Where(a.ID.Eq(ID)).Count()
	return count == 1
}

// Detail 留资活动详情
func (Activity) Detail(ctx context.Context, ID string) (record *models.MaActivity, err error) {
	a := dal.MaActivity
	return a.WithContext(ctx).Where(a.ID.Eq(ID)).Take()
}
